<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.shsh.safemanage.action.ActionCreator"%>
<%@page import="com.shsh.safemanage.action.WriteProblemAction"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.UserDao"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.util.Set"%>
<%@page import="java.util.Map"%>

<%
UserDao userDao = DaoCreator.createUserDao();
WriteProblemAction theWriteProblemAction = ActionCreator.createWriteProblemAction();
Map<Long, Set<Long>> manageGroupUserMap = (Map<Long, Set<Long>>) session.getAttribute(Constants.SESSION_MANAGE_GROUP_USER);
%>
<%
if (theWriteProblemAction.isShowShengChanManageGroup(request)) {
%>
<a href="javascript:" style="margin-left: 40px"
	onclick="openManageGroupDialog(<%=Constants.MANAGE_GROUP_ID_SHENGCHAN%>, getElementValueByID('depart1'), '选择管理组人员');">生产管理组</a>
<%
if (manageGroupUserMap != null) {
	Set<Long> set = manageGroupUserMap.get(Constants.MANAGE_GROUP_ID_SHENGCHAN);
	if (set != null) {
		for (Long userID : set) {
%>
<span style="margin-left: 2px; color: black;"><%=userDao.getUserByID(userID).getName()%></span>
<%
		}
	}
}
%>
<br />
<%
}
%>

<%
if (theWriteProblemAction.isShowShengchanShebeiManageGroup(request)) {
%>
<a href="javascript:" style="margin-left: 40px"
	onclick="openManageGroupDialog(<%=Constants.MANAGE_GROUP_ID_SHENGCHANSHEBEI%>, getElementValueByID('depart1'), '选择管理组人员');">生产设备管理组</a>
<%
if (manageGroupUserMap != null) {
	Set<Long> set = manageGroupUserMap.get(Constants.MANAGE_GROUP_ID_SHENGCHANSHEBEI);
	if (set != null) {
		for (Long userID : set) {
%>
<span style="margin-left: 2px; color: black;"><%=userDao.getUserByID(userID).getName()%></span>
<%
		}
	}
}
%>
<br />
<%
}
%>

<%
if (theWriteProblemAction.isShowJishuManageGroup(request)) {
%>
<a href="javascript:" style="margin-left: 40px"
	onclick="openManageGroupDialog(<%=Constants.MANAGE_GROUP_ID_JISHU%>, getElementValueByID('depart1'), '选择管理组人员');">技术管理组</a>
<%
if (manageGroupUserMap != null) {
	Set<Long> set = manageGroupUserMap.get(Constants.MANAGE_GROUP_ID_JISHU);
	if (set != null) {
		for (Long userID : set) {
%>
<span style="margin-left: 2px; color: black;"><%=userDao.getUserByID(userID).getName()%></span>
<%
		}
	}
}
%>
<br />
<%
}
%>

<%
if (theWriteProblemAction.isShowShebeiManageGroup(request)) {
%>
<a href="javascript:" style="margin-left: 40px"
	onclick="openManageGroupDialog(<%=Constants.MANAGE_GROUP_ID_SHEBEI%>, getElementValueByID('depart1'), '选择管理组人员');">设备管理组</a>
<%
if (manageGroupUserMap != null) {
	Set<Long> set = manageGroupUserMap.get(Constants.MANAGE_GROUP_ID_SHEBEI);
	if (set != null) {
		for (Long userID : set) {
%>
<span style="margin-left: 2px; color: black;"><%=userDao.getUserByID(userID).getName()%></span>
<%
		}
	}
}
%>
<br />
<%
}
%>

<%
if (theWriteProblemAction.isShowRedianYunxingManageGroup(request)) {
%>
<a href="javascript:" style="margin-left: 40px"
	onclick="openManageGroupDialog(<%=Constants.MANAGE_GROUP_ID_REDIANYUNXING%>, getElementValueByID('depart1'), '选择管理组人员');">热电运行部</a>
<%
if (manageGroupUserMap != null) {
	Set<Long> set = manageGroupUserMap.get(Constants.MANAGE_GROUP_ID_REDIANYUNXING);
	if (set != null) {
		for (Long userID : set) {
%>
<span style="margin-left: 2px; color: black;"><%=userDao.getUserByID(userID).getName()%></span>
<%
		}
	}
}
%>
<br />
<%
}
%>

<%
if (theWriteProblemAction.isShowCangchuManageGroup(request)) {
%>
<a href="javascript:" style="margin-left: 40px"
	onclick="openManageGroupDialog(<%=Constants.MANAGE_GROUP_ID_CANGCHU%>, getElementValueByID('depart1'), '选择管理组人员');">仓储管理组</a>
<%
if (manageGroupUserMap != null) {
	Set<Long> set = manageGroupUserMap.get(Constants.MANAGE_GROUP_ID_SHEBEI);
	if (set != null) {
		for (Long userID : set) {
%>
<span style="margin-left: 2px; color: black;"><%=userDao.getUserByID(userID).getName()%></span>
<%
		}
	}
}
%>
<br />
<%
}
%>

<a href="javascript:" style="margin-left: 40px"
	onclick="openManageGroupDialog(<%=Constants.MANAGE_GROUP_ID_HSE%>, getElementValueByID('depart1'), '选择管理组人员');">HSE管理组</a>
<%
if (manageGroupUserMap != null) {
	Set<Long> set = manageGroupUserMap.get(Constants.MANAGE_GROUP_ID_HSE);
	if (set != null) {
		for (Long userID : set) {
%>
<span style="margin-left: 2px; color: black;"><%=userDao.getUserByID(userID).getName()%></span>
<%
		}
	}
}
%>
<br />

<a href="javascript:" style="margin-left: 40px"
	onclick="openManageGroupDialog(<%=Constants.MANAGE_GROUP_ID_ZONGHE%>, getElementValueByID('depart1'), '选择管理组人员');">综合管理组</a>
<%
if (manageGroupUserMap != null) {
	Set<Long> set = manageGroupUserMap.get(Constants.MANAGE_GROUP_ID_ZONGHE);
	if (set != null) {
		for (Long userID : set) {
%>
<span style="margin-left: 2px; color: black;"><%=userDao.getUserByID(userID).getName()%></span>
<%
		}
	}
}
%>
<br />

<a href="javascript:" style="margin-left: 40px"
	onclick="openManageGroupDialog(<%=Constants.MANAGE_GROUP_ID_DANGQUN%>, getElementValueByID('depart1'), '选择管理组人员');">党群管理组</a>
<%
if (manageGroupUserMap != null) {
	Set<Long> set = manageGroupUserMap.get(Constants.MANAGE_GROUP_ID_DANGQUN);
	if (set != null) {
		for (Long userID : set) {
%>
<span style="margin-left: 2px; color: black;"><%=userDao.getUserByID(userID).getName()%></span>
<%
		}
	}
}
%>
<br />

<%
if (theWriteProblemAction.isShowGongyongGongchengManageGroup(request)) {
%>
<a href="javascript:" style="margin-left: 40px"
	onclick="openManageGroupDialog(<%=Constants.MANAGE_GROUP_ID_GONGYONGGONGCHENG%>, getElementValueByID('depart1'), '选择管理组人员');">公用工程管理部</a>
<%
if (manageGroupUserMap != null) {
	Set<Long> set = manageGroupUserMap.get(Constants.MANAGE_GROUP_ID_GONGYONGGONGCHENG);
	if (set != null) {
		for (Long userID : set) {
%>
<span style="margin-left: 2px; color: black;"><%=userDao.getUserByID(userID).getName()%></span>
<%
		}
	}
}
%>
<br />
<%
}
%>

<%
if (theWriteProblemAction.isShowKeyanJishuFuwuManageGroup(request)) {
%>
<a href="javascript:" style="margin-left: 40px"
	onclick="openManageGroupDialog(<%=Constants.MANAGE_GROUP_ID_KEYAN_JISHU_FUWU%>, getElementValueByID('depart1'), '选择管理组人员');">科研管理/技术服务组</a>
<%
if (manageGroupUserMap != null) {
	Set<Long> set = manageGroupUserMap.get(Constants.MANAGE_GROUP_ID_KEYAN_JISHU_FUWU);
	if (set != null) {
		for (Long userID : set) {
%>
<span style="margin-left: 2px; color: black;"><%=userDao.getUserByID(userID).getName()%></span>
<%
		}
	}
}
}
%>
<script type="text/javascript">
function openManageGroupDialog(id, depart1ID, title) {
	var queryStr = '';
	if (id != null && id != '') {
		queryStr = 'id=' + id;
	}
	if (depart1ID != null && depart1ID != '') {
		queryStr = queryStr + '&depart1ID=' + depart1ID;
	}
	openDialogPage('manage_group_userlist.jsp?' + queryStr, 'manageGroupUserListDialog', title);
}
</script>